﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Text;

namespace Commons
{
    public static class MyConfigurationSection
    {
        private static IConfigurationSection _appSection = null;
        /// <summary>
        /// 获取到配置的Value
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string AppSetting(string key)
        {
            string str = string.Empty;
            if (_appSection.GetSection(key) != null)
            {
                str = _appSection.GetSection(key).Value;
            }
            return str;
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="section"></param>
        public static void SetAppSetting(IConfigurationSection section)
        {
            _appSection = section;
        }
        public static string GetSite(string apiName)
        {
            return AppSetting(apiName);
        }

    }
}
